<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.formatCurrency-1.4.0.pack.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.numeric.js'/>"></script>
<script src="<c:url value='/js/jquery/jqueryFileTree/jqueryFileTree.js' />" type="text/javascript"></script>
<script src="<c:url value='/js/file-browser.js' />" type="text/javascript"></script>
<link href="<c:url value='/js/jquery/jqueryFileTree/jqueryFileTree.css' />" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	$(document).ready(function() {
		$('#pageTitle').text('<spring:message code="editPartnergrantView.heading" />');
		
		$("#editPartnergrantForm").validate({
			rules : {
				/*partner : {
					required : true
				},*/
				acronym : {
					required : true
				},
				costCenterNumber : {
					required : true
				},
				/*projectTitle : {
					required : true
				},
				donoraward : {
					required : true
				},
				projectStartDate : {
					required : true
				},
				projectEndDate : {
					required : true
				},*/
				partnerGrantStartDate : {
					required : true
				},
				partnerGrantEndDate : {
					required : true
				},
				cipeprojecttype : {
					required : true
				},
				cipeprojectstatus : {
					required : true
				},
				region : {
					required : true
				},
				country : {
					required : true
				},
				seniorProgramOfficer : {
					required : true
				},
				programOfficer : {
					required : true
				},
				programAssistant : {
					required : true
				},
				/*partnerGrantFunds : {
					required : true
				},
				matchingFunds : {
					required : true
				},
				totalFunds : {
					required : true
				},*/
				riskAssessmentScore : {
					number: true
				}				
			}
		});

		$('#partnerGrantFunds').numeric();

		$('#partnerGrantFunds').formatCurrency('#partnerGrantFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		showSubstitute(true, 'partnerGrantFundsLabel','partnerGrantFunds');

		$('#partnerGrantFunds').blur(function(){
			$('#partnerGrantFunds').formatCurrency('#partnerGrantFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
			showSubstitute(true, 'partnerGrantFundsLabel','partnerGrantFunds');
		});

		$('#partnerGrantFundsLabel').click(function(){
			showSubstitute(false, 'partnerGrantFundsLabel','partnerGrantFunds');
		});

		$('#partnerGrantFundsLabel').focus(function() {
			$('#partnerGrantFundsLabel').css('display', 'none');
			$('#partnerGrantFunds').css('display', 'block');
			$('#partnerGrantFunds').focus();
		});

		$('#matchingFunds').numeric();

		$('#matchingFunds').formatCurrency('#matchingFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		showSubstitute(true, 'matchingFundsLabel','matchingFunds');

		$('#matchingFunds').blur(function(){
			$('#matchingFunds').formatCurrency('#matchingFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
			showSubstitute(true, 'matchingFundsLabel','matchingFunds');
		});

		$('#matchingFundsLabel').click(function(){
			showSubstitute(false, 'matchingFundsLabel','matchingFunds');
		});

		$('#matchingFundsLabel').focus(function() {
			$('#matchingFundsLabel').css('display', 'none');
			$('#matchingFunds').css('display', 'block');
			$('#matchingFunds').focus();
		});

		$('#totalPartnerFunds').formatCurrency('#totalPartnerFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
		showSubstitute(true, 'totalPartnerFundsLabel', 'totalPartnerFunds');
		

		function showSubstitute(show, subId, tobeSubId) {
			if(show) {
				$('#' + subId).css('display', 'block');
				$('#' + tobeSubId).css('display', 'none');
			} else {
				$('#' + subId).css('display', 'none');
				$('#' + tobeSubId).css('display', 'block');
				$('#' + tobeSubId).focus();
			}
		}
		
		function showSubstituteAnchor(show, subId, tobeSubId) {
			if(show) {
				$('#' + subId).css('display', 'inline');
				$('#' + tobeSubId).css('display', 'none');
			} else {
				$('#' + subId).css('display', 'none');
				$('#' + tobeSubId).css('display', 'inline');
			}
		}
		
		//$("#partnerGrantFunds").numeric();
		//$("#matchingFunds").numeric();
		
		$("#partnerGrantFunds").bind("change", calcTotalFunds);
		$("#matchingFunds").bind("change", calcTotalFunds).trigger("change");
		
		var partnerGrantSaved = '${projectGrantSaved}';
/* 		if(partnerGrantSaved == 'true') {
			if(confirm('Do you want to Enter Reporting Requirements at this time?')) {
			   loadDiv('content', 'showAddReportingrequirements.do');
			}
		} else {
			
		} */
		
		showSubstituteAnchor(true, 'editAgreementDis','editAgreement');
		showSubstituteAnchor(true, 'viewAgreementDis','viewAgreement');
		
		$('#editButton').click(function() {
			var inputs = $('#editPartnergrantForm input:not(.uneditable)');
			var selects = $('#editPartnergrantForm select');
			var checkboxes = $('#editPartnergrantForm checkbox');

			inputs.each(function() {
				$(this).removeAttr('readonly');
				$(this).removeAttr('disabled');
			});
			selects.each(function() {
				$(this).removeAttr('readonly');
				$(this).removeAttr('disabled');
			});
			checkboxes.each(function() {
				$(this).removeAttr('readonly');
				$(this).removeAttr('disabled');
			});
			$(this).attr('disabled','disabled');
			$('#cancelEditButton').removeAttr('disabled');
			$('#save').removeAttr('disabled');
			showSubstituteAnchor(true, 'editAgreement','editAgreementDis');
			showSubstituteAnchor(true, 'viewAgreement','viewAgreementDis');
		});
		
		<c:if test="${cipeproject.id !=null and cipeproject.id gt 0}">
			var inputs = $('#editPartnergrantForm input[type="text"]:not(.uneditable)');
			var selects = $('#editPartnergrantForm select');
			var checkboxes = $('#editPartnergrantForm checkbox');
	
			inputs.each(function() {
				$(this).attr('disabled','disabled');
			});
			selects.each(function() {
				$(this).attr('disabled','disabled');
			});
			checkboxes.each(function() {
				$(this).attr('readonly','readonly');
			});
			$('#cancelEditButton').attr('disabled','disabled');
			$('#save').attr('disabled','disabled');
		</c:if>
		
		$('#cancelEditButton').click(function() {
			var ans = confirm('Are you sure you want to cancel editing this record without saving it?');
			if (ans) {
				var uri = '${rc.requestUri}';
				<c:if test="${cipeproject.id !=null and cipeproject.id gt 0}">
				uri += "?id=${cipeproject.id}";
				</c:if>
				loadDiv('content', uri);
			}
		});
		
		$('#cancelButton').click(function() {
			var ans = confirm('Are you sure you want to cancel editing this record without saving it?');
			if (ans) {
				loadDiv('content', 'findCipeproject.do');
			}
		});
		
		$("#projectStartDate").datepicker();
		$("#projectEndDate").datepicker();
		$("#receivedingrantsforapproval").datepicker();
		$("#receiptOfSignedAgreement").datepicker();
		$("#receiptOfSignatureAuthorization").datepicker();
		$("#receiptOfBankInformation").datepicker();
		$("#fiscalyear").datepicker({
			dateFormat : 'yy'
		});
		
    	var modificationLocationBrowser = new FileBrowser('S:\\Scanned Documents','<c:url value="/js/jquery/jqueryFileTree/connectors/jqueryFileTree.jsp" />', 
    			function(file) {
    				$('#modificationDocumentLocation').val(file);
    			},
    			function(dir) {
    			},
    			function() {
    				$('#doSave').click();
    				// OK Listener
    			},
    			function() {
    				$('#doSave').click();
    				// OK Listener
    			}
    	);
    	modificationLocationBrowser.setTitle('Select modification document file');
    	
    	$('#save').click(function() {
    		var prevStartDate = '${cipeproject.prevStartDate}';
    		var prevEndDate = '${cipeproject.prevEndDate}';
    		var prevPartnerGrantFunds = ${cipeproject.prevPartnerGrantFunds};
    		var prevStatus = '';
    		<c:if test="${!empty cipeproject.prevStatusId}">
    		prevStatus = '${cipeproject.prevStatusId}';
    		</c:if>
    		
    		var currStartDate = $('#projectStartDate').val();
    		var currEndDate = $('#projectEndDate').val();
    		var partnerGrantFunds = $('#partnerGrantFunds').val();
    		if('' == partnerGrantFunds.trim()) {
    			partnerGrantFunds = 0;
    		}
    		var currStatus = $('#cipeprojectstatus').val();
    		
    		if(prevStartDate != currStartDate 
    			|| prevEndDate != currEndDate
    			|| prevPartnerGrantFunds != partnerGrantFunds
    			|| prevStatus != currStatus) {
    			modificationLocationBrowser.open();
    		} else {
    			$('#doSave').click();
    		}
    	});

    	$('.attachmentPath').click(function() {
			var fileName = $('div', this).text();
			window.open("<c:url value='/openFile.do' />?fileName=" + fileName, "_blank", "left=20, top=20, width=700, height=700, toolbar=1, resizable=0").focus();
		});
    	
    	$("#riskAssessmentScore").val($("#riskAssessmentScore").val()!= "" ? parseFloat($("#riskAssessmentScore").val()).toFixed(0) : "");
    	
		$('#editAgreement').click(function() {
			var path = $('#fileLocation').val();
			if($.trim(path) == '') {
				path = 'S:\\Scanned Documents';
			} else {
				if( path.charAt(path.length - 4) == '.') {
					path = path.substring(0, path.lastIndexOf('\\'));	
				}
			}
			
			var agreementFileBrowser = new FileBrowser(path,'<c:url value="/js/jquery/jqueryFileTree/connectors/jqueryFileTree.jsp" />', 
				function(file) {
					$('#fileLocation').val(file);
				}
			);
			
			agreementFileBrowser.open();
		});
		
		$('#viewAgreement').click(function() {
			var fileName = $('#fileLocation').val();
			if('' != fileName) {
				window.open("<c:url value='/openFile.do' />?fileName=" + fileName, "_blank", "left=20, top=20, width=700, height=700, toolbar=1, resizable=0").focus();
			}
		});
	});

	
	function calcTotalFunds() {
		var fundsAmnt = $("#partnerGrantFunds").val().trim();
		var matchAmnt = $("#matchingFunds").val().trim();
		var x1 = (fundsAmnt != "") ? ((isNaN(fundsAmnt) ? 0 : parseFloat(fundsAmnt))) : 0;
		var x2 = (matchAmnt != "") ? ((isNaN(matchAmnt) ? 0 : parseFloat(matchAmnt))) : 0;
		$("#totalPartnerFunds").val(x1 + x2);
		$('#totalPartnerFunds').formatCurrency('#totalPartnerFundsLabel',{colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -2});
	}
	
	function getFiscalYear() {
		var str1 = document.getElementById("projectStartDate").value;

		var mon1 = parseInt(str1.substring(0, 2), 10);
		var dt1 = parseInt(str1.substring(3, 5), 10);
		var yr1 = parseInt(str1.substring(6, 10), 10);
		var dt2 = 1;
		var mon2 = 10;
		var date1 = new Date(yr1, mon1, dt1);
		var date2 = new Date(yr1, mon2, dt2);
		if (date2 < date1) {
			document.getElementById("fiscalyear").value = yr1;
		} else {
			document.getElementById("fiscalyear").value = parseInt(yr1) - 1;
		}
		$('.edit-cipeproject-link').click(function() {
			loadDiv('content', 'showEditCipeproject.do?id=' + $(this).attr('cipeprojectId'));
		});
	}
	$('.view-knowledgemanagement-link').click(function() {
		loadDiv('content', 'showEditKnowledgeManagement.do?id=' + $(this).attr('cipeprojectId'));
	});
	$('.view-modifications-link').click(function() {
			loadDiv('content', 'showCipeprojectModifications.do?id='
					+ $(this).attr('cipeprojectId'));
	});
	$('.view-rollup-link').click(function() {
		loadDiv('content', 'showCipeprojectSummary.do?id=' + $(this).attr('cipeprojectId'));
	});
	$('.view-loggedpayments-link').click(function() {
		loadDiv('content', 'showCipeprojectPaymentRequestLineItems.do?id=' + $(this).attr('cipeprojectId'));
	});
	$('.view-cipeprojectdetail-link').click(function() {
		loadDiv('content', 'showEditCipeprojectDetail.do?id=' + $(this).attr('cipeprojectId'));
	});
	$('.view-cipeprojectsummary-link').click(function() {
		loadDiv('content', 'showCipeprojectSummary.do?id=' + $(this).attr('cipeprojectId'));
	});
	$('.add-reporting-link').click(function() {
		loadDiv('content', 'showAddReportingrequirements.do?cipeprojectId=' + $(this).attr('cipeprojectId'));
	});
	$('.add-partnermonitoring-link').click(function() {
		loadDiv('content', 'auditsForm.do?cipeprojectId=${cipeproject.id}');
	});
	$('.edit-donoraward').click(function() {
		var donorawardId = $("#donorawardId").val();
		if (donorawardId != null) {
			loadDiv('content', 'showEditDonoraward.do?id=' + donorawardId);
		}
	});
	
		$('.close-button').click(function() {
		window.location = '../secure/showDashboard.do';
		//if(confirm('Are you sure that you want to close the form?')) {
			//window.location = '../secure/showDashboard.do';
		//}	
	});
</script>
<div id="editPartnergrantView">
	<form:form name="editPartnergrantForm" id="editPartnergrantForm" action="savePartnergrant.do" method="post" modelAttribute="cipeproject">
        <form:hidden path="modificationDocumentLocation"/>
		<form:hidden path="id" />
		<form:hidden path="formName" value="view"/>
		<div class="main_form">
			<div class="form_head">
				<div class="floatL" style="padding-top:5px;">
					<%-- <a href="#" class="blue_btn view-knowledgemanagementsearch-link"><spring:message code="findPartnergrant.link.viewKnowledgeManagement" /></a> --%>
					<c:choose>
			            <c:when test="${cipeproject.parentProject.id !=null and cipeproject.parentProject.id gt 0}">
							<a href="#" class="blue_btn view-cipeprojectsummary-link" cipeprojectId="${cipeproject.parentProject.id}"><spring:message code="editPartnergrant.link.viewProject" /></a>&nbsp;
						</c:when>
						<c:otherwise>
					       	<span class="gray_btn" tabindex="-1"><spring:message code="editPartnergrant.link.viewProject" /></span>&nbsp;
					    </c:otherwise>
					</c:choose>
					<a href="#" class="blue_btn add-reporting-link" cipeprojectId="${cipeproject.id}"><spring:message code="editPartnergrant.link.reporting"/></a>&nbsp;
					<a href="#" class="blue_btn add-partnermonitoring-link" cipeprojectId="${cipeproject.id}"><spring:message code="editPartnergrant.link.partnerMonitoring" /></a>
					<a href="#" class="blue_btn view-loggedpayments-link" cipeprojectId="${cipeproject.id}"><spring:message code="editCipeprojectSummary.link.payments"/></a>&nbsp;
				</div>
				<div class="floatL" style="padding-top:5px;">
					<a href="#" class="blue_btn view-knowledgemanagement-link" cipeprojectId="${cipeproject.id}"><spring:message code="editCipeprojectSummary.link.knowledgemanagement" /></a>&nbsp;
					<%-- <a href="#" class="blue_btn view-knowledgemanagement-link" cipeprojectId="${cipeproject.id}"><spring:message code="editCipeprojectSummary.link.knowledgemanagementProject"/></a>&nbsp; --%>
					<a href="#" class="blue_btn view-modifications-link" cipeprojectId="${cipeproject.id}"><spring:message code="editCipeprojectSummary.link.modifications" /></a>&nbsp;
					<a class="blue_btn " href="mailto:grantsmanagement@cipe.org?Subject=Data%20Discrepency%20Found%20-%20Project%20#%20${cipeproject.projectID}">
						<spring:message	code="editCipeprojectSummary.link.notify"/>
					</a>
				</div>
    			<a href="#" class="close-button gray_btn floatR">Close Form</a>
    			<br class="clear" />
	    	</div>
	    	<div class="form_cont">
				<table class="fiveColTable" width="100%" cellspacing="1" cellpadding="0">
					<tr class="row">
						<td colspan="5">
							<%@ include file="/common/messages.jsp" %>
						</td>
					</tr>
					<tr>
					<tr class="row">
						<td class="label"><spring:message code="editPartnergrant.label.partner" /></td>
						<td class="input-field">
							<form:select path="partner.id" cssStyle="width: 74%" cssClass="input-full-width uneditable text_white-req text_blue">
								<form:options items="${partnerList}" itemValue="id" itemLabel="partnerName" />
							</form:select>
                            <sj:submit id="addPartner" nameKey="editPartnergrant.name.button.addeditpartner" attr="disabled='disabled'" cssClass="blue_btn cancel" cssStyle="width: 20%; min-width: 55px;"  target="content" key="link.add" tabindex="-1"/>
							<form:errors path="partner.id" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						<td class="label" ><spring:message code="editPartnergrant.label.riskAssessment" /></td>
						<td class="input-field">
							<form:input path="riskAssessmentScore" disabled="true" cssClass="input-full-width text_white" />
							<form:errors path="riskAssessmentScore" cssClass="error" />
						</td>
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.projectID" /></td>
						<td class="input-field">
							<form:input path="projectID" disabled="true" cssClass="input-full-width uneditable text_white"/>
							<form:errors path="projectID" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.receivedingrantsforapproval" /></td>
						<td class="input-field">
							<form:input path="receivedingrantsforapproval" cssClass="input-full-width text_white" tabindex="16"/>
							<form:errors path="receivedingrantsforapproval" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.startDate" /></td>
						<td class="input-field">
							<form:input path="parentProject.projectStartDate" disabled="true" cssClass="input-full-width uneditable text_white-req text_blue" onchange="getFiscalYear()" />
							<form:errors path="projectStartDate" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.receiptOfSignedAgreement" /></td>
						<td class="input-field">
							<form:input path="receiptOfSignedAgreement" cssClass="input-full-width text_white" tabindex="17"/>
							<form:errors path="receiptOfSignedAgreement" cssClass="error" />
						</td>
						
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.endDate" /></td>
						<td class="input-field">
							<form:input path="parentProject.projectEndDate" disabled="true" cssClass="input-full-width uneditable text_white-req text_blue" />
							<form:errors path="projectEndDate" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.receiptOfSignatureAuthorization" /></td>
						<td class="input-field">
							<form:input path="receiptOfSignatureAuthorization" cssClass="input-full-width text_white" tabindex="18"/>
							<form:errors path="receiptOfSignatureAuthorization" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.nedIdentifier" /></td>
						<td class="input-field">
							<form:input disabled="true" path="nedIdentifier" cssClass="input-full-width uneditable text_white"/>
							<form:errors path="nedIdentifier" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label" ><spring:message code="editPartnergrant.label.receiptOfBankInformation" /></td>
						<td class="input-field">
							<form:input path="receiptOfBankInformation" cssClass="input-full-width text_white" tabindex="19"/>
							<form:errors path="receiptOfBankInformation" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.donorAwardID" /></td>
						<td class="input-field">
							<form:input  disabled="true" cssStyle="width: 70%;" path="donoraward.donorAwardNumber"  cssClass="input-full-width uneditable text_grey" />
							<form:hidden id="donorawardId" path="donoraward.id" />
							<input type="button" style="width: 20%; min-width: 55px;" class="edit-donoraward blue_btn" disabled="disabled" value="<spring:message code="link.view" />">
														
							<form:errors path="donoraward.donorAwardNumber" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.donorName" /></td>
						<td class="input-field">
							<form:input path="donoraward.donor.donorName" disabled="true" cssClass="input-full-width uneditable text_white" />
							<form:errors path="donoraward.donor.donorName" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="label.createdBy" /></td>
						<td class="input-field">
							<form:input disabled="true" path="createdBy.fullName" cssClass="input-full-width uneditable text_grey" />
							<form:errors path="createdBy" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.grantStartDate" /></td>
						<td class="input-field">
							<form:input path="projectStartDate" cssClass="input-full-width text_white-req text_blue" tabindex="1"/>
							<form:errors path="projectStartDate" cssClass="error" />
						</td>
					
						
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="label.creationDate" /></td>
						<td class="input-field">
							<form:input disabled="true" path="creationDate" cssClass="input-full-width uneditable text_grey" />
							<form:errors path="creationDate" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.grantEndDate" /></td>
						<td class="input-field">
							<form:input path="projectEndDate" cssClass="input-full-width text_white-req text_blue" tabindex="2"/>
							<form:errors path="projectEndDate" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="label.updatedBy" /></td>
						<td class="input-field">
							<form:input disabled="true" path="updatedBy.fullName" cssClass="input-full-width uneditable text_grey" />
							<form:errors path="updatedBy" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.acronym" /></td>
						<td class="input-field">
							<form:input path="acronym" cssClass="input-full-width text_white" tabindex="3"/>
							<form:errors path="acronym" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="label.updationDate" /></td>
						<td class="input-field">
							<form:input disabled="true" path="updationDate" cssClass="input-full-width uneditable text_grey" />
							<form:errors path="updationDate" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.projectTitle" /></td>
						<td class="input-field">
							<form:input path="projectTitle" cssClass="input-full-width text_white" tabindex="4"/>
							<form:errors path="projectTitle" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.accountingQuestionnaire" /></td>
						<td class="input-field">
							<form:checkbox disabled="true" path="accountingQuestionnaireReceived" value="true" tabindex="21"/>
							<form:errors path="accountingQuestionnaireReceived" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.status" /></td>
						<td class="input-field">
							<form:select id="cipeprojectstatus" path="cipeprojectstatus.id" cssClass="input-full-width text_white-req text_blue" tabindex="5">
							<c:choose>
									<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
										<form:option value="${cipeproject.cipeprojectstatus.id}" label="${cipeproject.cipeprojectstatus.displayName}"></form:option>
									</c:when>
									<c:otherwise>
										<form:option value="" label="Select" />
									</c:otherwise>
							</c:choose>
								<form:options items="${cipeprojectstatusList}" itemValue="id" itemLabel="displayName" />
							</form:select>
							<form:errors path="cipeprojecttype.id" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.checkPerformed" /></td>
						<td class="input-field">
							<form:checkbox disabled="true" path="terroristCheckPerformed" value="true" tabindex="22"/>
							<form:errors path="terroristCheckPerformed" cssClass="error" />
						</td>
						<!-- <td class="label">&nbsp;</td>
						<td></td> -->
					</tr>
					<tr class="row" >
					
						<td class="label"><spring:message code="editPartnergrant.label.region" /></td>
						<td class="input-field">
							<form:select path="region.id" cssClass="input-full-width text_white-req text_blue" tabindex="6">
								<form:options items="${regionList}" itemValue="id" itemLabel="displayName" />
							</form:select>
							<form:errors path="region.id" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.blockTimeSheet" /></td>
						<td class="input-field">
							<form:checkbox disabled="true" path="blockTimeSheet" checked="true" tabindex="23"/>
							<form:errors path="blockTimeSheet" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.country" /></td>
						<td class="input-field">
							<form:select path="country.id" cssClass="input-full-width text_white-req text_blue" tabindex="7">
								<form:options items="${countryList}" itemValue="id" itemLabel="displayName" />
							</form:select>
							<form:errors path="country.id" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.override" /></td>
						<td class="input-field">
							<form:checkbox disabled="true" path="override" value="true" tabindex="24"/>
							<form:errors path="override" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.programOfficer" /></td>
						<td class="input-field">
							<form:select path="programOfficer.id" cssClass="input-full-width text_white-req text_blue" tabindex="8">
								<form:options items="${programOfficerList}" itemValue="id" itemLabel="fullName" />
							</form:select>
							<form:errors path="programOfficer.id" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
						<td class="label"><spring:message code="editPartnergrant.label.statusOverride" /></td>
						<td class="input-field">
							<form:checkbox disabled="true" path="statusoverride" value="true" tabindex="25"/>
							<form:errors path="statusoverride" cssClass="error" />
						</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.programAssistant" /></td>
						<td class="input-field">
							<form:select path="programAssistant.id" cssClass="input-full-width text_white-req text_blue" tabindex="9">
								<form:options items="${programAssistantList}" itemValue="id" itemLabel="fullName" />
							</form:select>
							<form:errors path="programAssistant.id" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.seniorProgramOfficer" /></td>
						<td class="input-field">
							<form:select path="seniorProgramOfficer.id" cssClass="input-full-width text_white-req text_blue" tabindex="10">
								<form:options items="${seniorProgramOfficerList}" itemValue="id" itemLabel="fullName" />
							</form:select>
							<form:errors path="seniorProgramOfficer.id" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.partnerGrantFunds" /></td>
						<td class="input-field">
							<form:input path="partnerGrantFunds" cssClass="input-full-width text_white-req text_blue" tabindex="11"/>
							<input type="text" value="&nbsp;" readonly="readonly"  id="partnerGrantFundsLabel" class="uneditable input-sub input-full-width-req text_blue" tabindex="11"/>
							<form:errors path="partnerGrantFunds" cssClass="error" />
						</td>
						
						<td class="fiveColSpacer">&nbsp;</td>
						
					</tr>
					<tr class="row">
					
						<td class="label"><spring:message code="editPartnergrant.label.matchingFunds" /></td>
						<td class="input-field">
							<form:input path="matchingFunds" cssClass="input-full-width-req text_blue" tabindex="12"/>
							<input type="text" value="&nbsp;" readonly="readonly"  id="matchingFundsLabel" class="uneditable input-sub input-full-width-req text_blue" tabindex="12"/>
							<form:errors path="matchingFunds" cssClass="error" />
						</td>
					
						
						<td class="fiveColSpacer">&nbsp;</td>
						
					</tr>
					<tr>
					
						<td class="label"><spring:message code="editPartnergrant.label.totalFunds" /></td>
						<td class="input-field">
							<form:input path="totalPartnerFunds" disabled="true" cssClass="input-full-width text_grey" />
							<input type="text" value="&nbsp;" readonly="readonly"  id="totalPartnerFundsLabel" class="uneditable input-sub input-full-width-req text_blue"/>
							<form:errors path="totalPartnerFunds" cssClass="error" />
						</td>
					
						
					</tr>
					<tr>
					
					<td class="label"><spring:message code="editPartnergrant.label.fileLocation" /></td>
						<td class="input-field">
							<form:input path="fileLocation" cssStyle="width: 64%;" cssClass=" input-full-width text_white" tabindex="13" value="S:\\Scanned Documents\\" />
							<a href="#" id="editAgreement" onclick="return false;" style="width: 9%; min-width: 0; padding: 5px; margin: 0" class="blue_btn"><spring:message code="label.edit" /></a>
							<a href="#" id="viewAgreement"	onclick="return false;" style="width: 9%; min-width: 0; padding: 5px; margin: 0" class="blue_btn"><spring:message code="label.view" /></a>
							
							<a href="#" id="editAgreementDis" onclick="return false;" style="width: 9%; min-width: 0; padding: 5px; margin: 0" class="blue_btn"><spring:message code="label.edit" /></a>
							<a href="#" id="viewAgreementDis"	onclick="return false;" style="width: 9%; min-width: 0; padding: 5px; margin: 0" class="blue_btn"><spring:message code="label.view" /></a>
							<form:errors path="fileLocation" cssClass="error" />
						</td>
						<td class="fiveColSpacer">&nbsp;</td>
					</tr>
					<tr>
					
						<td class="label"><spring:message code="editPartnergrant.label.fiscalYear" /></td>
						<td class="input-field">
							<form:input path="fiscalYear" cssClass="input-full-width text_white" tabindex="14"/>
							<form:errors path="fiscalYear" cssClass="error" />
						</td>
					
					</tr>
					<tr>
					
						<td class="label"><spring:message code="editPartnergrant.label.memo" /></td>
						<td class="input-field">
							<form:input path="memo" cssClass="input-full-width text_white" tabindex="15"/>
							<form:errors path="memo" cssClass="error" />
						</td>
					
					</tr>
					
					<tr>
	                	<td class="label">&nbsp;</td>
	                	<td>&nbsp;</td>
	                	<td class="fiveColSpacer">&nbsp;</td>
	                	<td class="label">&nbsp;</td>
	                	<td></td>
	              	</tr>
	              	<tr>
						<td colspan="5" style="text-align: center;">
							<c:choose>
								<c:when test="${cipeproject.id !=null and cipeproject.id gt 0}">
									<input id="editButton" type="button" value="Edit" class="blue_btn" tabindex="-1"/>
									<input id="cancelEditButton" disabled="disabled" type="button" value="Cancel Edit" class="gray_btn" tabindex="-1"/>
								</c:when>
								<c:otherwise>
								</c:otherwise>
							</c:choose>
                            <input type="button" id="save" class="blue_btn" value="<spring:message code="editPartnergrant.button.save" />" tabindex="-1">
                            <sj:submit id="doSave" target="editPartnergrantView" key="editPartnergrant.button.save" validate="true" cssClass="hiddenSubmitButton" tabindex="-1" />
							<%-- <input class="blue_btn" checked="checked" type="reset" value="<spring:message code='editPartnergrant.button.cancel' />" /> --%>
						</td>	              	
	              	</tr>
				</table>
				
				<table>
					<thead>
						<tr>
							<th></th>
							<th style="border: 1px solid black; background-color: #CCFB5D"><spring:message code="editPartnergrant.table.heading.budgetAmount" /></th>
							<th style="border: 1px solid black; background-color: #CCFB5D"><spring:message code="editPartnergrant.table.heading.disbursedAmount" /></th>
							<th style="border: 1px solid black; background-color: #CCFB5D"><spring:message code="editPartnergrant.table.heading.balanceAmount" /></th>
							<th style="border: 1px solid black; background-color: #CCFB5D"><spring:message code="editPartnergrant.table.heading.burnRate" /></th>
						</tr>
					</thead>
					<tbody>
							<tr>
								<td style="border: 1px solid black; background-color: #CCFB5D"><spring:message code="editPartnergrant.table.heading.partnerGrants" /></td>
								<td><fmt:formatNumber type="currency" value="${cipeproject.partnerBudgetAmount}" pattern="$#,##0;" /></td>
								<td><fmt:formatNumber type="currency" value="${cipeproject.partnerDisbursedAmount}" pattern="$#,##0;" /></td>
								<td><fmt:formatNumber type="currency" value="${cipeproject.partnerBalanceAmount}" pattern="$#,##0;" /></td>
								<td><fmt:formatNumber type="number" maxFractionDigits="3" value="${burnRate}"></fmt:formatNumber></td>
							</tr>
					</tbody>
				</table>
				
				<br class="clear" />
				<table class="tablesorter">
					<thead>
						<tr>
							<th>ID</th>
							<th>Modification Type</th>
							<th>Modified From</th>
							<th>Modified To</th>
							<th>Modified Date</th>
							<th>Modified By</th>
							<th>File Location of Modified Document</th>
						</tr>
					</thead>
					<tbody>
					<c:choose>
						<c:when test="${fn:length(cipeproject.cipeprojectmodifications) > 0}">
						<c:forEach items="${cipeproject.cipeprojectmodifications}" var="modification">
							<tr>
								<td>${modification.id}</td>
								<td>${modification.modificationType.modificationTypeDesc}</td>
								<td>${modification.modifiedFrom}</td>
								<td>${modification.modifiedTo}</td>
								<td>${modification.formattedModifiedDate}</td>
								<td>${modification.modifiedBy.fullName}</td>
                                <td><a href="#" onclick="return false;" class="attachmentPath">${modification.attachment}</a></td>
							</tr>
						</c:forEach>
						</c:when>
						<c:otherwise>
							<tr>
								<td colspan="7" style="padding-left: 10px;">No modifications found.</td>
							</tr>
						</c:otherwise>
					</c:choose>
					</tbody>
				</table>				
			</div>
		</div>
	</form:form>
</div>